package com.haisen.dataobject.entity;

import com.haisen.core.utils.DateUtil;
import com.haisen.core.utils.RegexUtil;
import com.haisen.poi.basic_poi.ExcelResources;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.springframework.util.StringUtils;

import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@Table(name = "tb_buss_item")
public class BussItem {
    /**
     * 编号
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 日期
     */
    private String cdate;

    /**
     * 办理渠道，微信，门店，营销方案
     */
    @Column(name = "handler_channel")
    private String handlerChannel;

    /**
     * 手机号码
     */
    //@NotBlank(message = "手机号码不能为空")
   // @Pattern(regexp = "1[3|4|5|7|8][0-9]\\d{8}",message = "号码错误，不满足手机正则表达式")
    private String phone;

    /**
     * 副卡号码
     */
    @Column(name = "phone_second")
    private String phoneSecond;

    /**
     * 办理业务
     */
    @Column(name = "biz_type")
    private String bizType;

    /**
     * 业务明细
     */
    @Column(name = "biz_detail")
    private String bizDetail;

    /**
     * 原产品规格
     */
    @Column(name = "spec_pri")
    private String specPri;
    /**
     * 新产品规格
     */
    @Column(name = "spec_cur")
    private String specCur;

    /**
     * 金额
     * 题目:校验商品价格的正则表达式
     * 目的:校验输入的商品价格:不能为(负数或001这样的数字),其他正整数或小数均为true
     * 正则说明:"\\d\\.\\d*|[1-9]\\d*|\\d*\\.\\d*|\\d
     */

    @Column(name = "sum_money")
   // @Pattern(regexp ="\\d\\.\\d*|[1-9]\\d*|\\d*\\.\\d*|\\d",message = "金额格式不对，例如：1.00")
    @Digits(integer = 3,fraction = 2,message = "金额必须为数字，最高1000")
    private BigDecimal sumMoney;
    /**
     * 工号明细
     */
    @Column(name="handler_no")
    private String handlerNo;

    /**
     * 门店名称
     */

    @Column(name = "organization_name")
    private String organizationName;

    /**
     * 办理方式
     */

    @Column(name = "handle_type")
    private String handleType;

    /**
     * 批次号
     */

    @Column(name = "batch_no")
    private String batchNo;

    /**
     * 包编
     */

    @Column(name = "package_no")
    private String packageNo;

    /**
     * 月赠送金额
     */

    @Column(name = "donate_month")
   // @Pattern(regexp ="\\d\\.\\d*|[1-9]\\d*|\\d*\\.\\d*|\\d",message = "金额格式不对，例如：1.00")
    private BigDecimal donateMonth;

    /**
     * 单元编码
     */

    @Column(name = "organization_no")
    private String organizationNo;

    /**
     * 员工姓名
     */

    private String employer;

    /**
     * 计件酬金
     */

    @Column(name = "reward_piecework")
    private BigDecimal rewardPiecework;

    /**
     * 移动积分
     * 正则值能用于校验字符串
     * @Pattern(regexp ="\\d\\.\\d*|[1-9]\\d*|\\d*\\.\\d*|\\d",message = "金额格式不对，例如：1.00")
     */
    private BigDecimal score;

/**
 *手机/套卡/配件差价
 */
    @Column(name="parts_balance")
    private  BigDecimal partsBalance;

    /**
     * 提成
     */
   // @NotNull
    private BigDecimal commission;


    private Integer verify;

    /**
     * 备注
     */

    private String remark;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    private Date createTime;

    /**
     * 修改时间
     */
    @Column(name = "update_time")
    private Date updateTime;

    /**
     * 获取编号
     *
     * @return id - 编号
     */
    public Long getId() {
        return id;
    }

    /**
     * 设置编号
     *
     * @param id 编号
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * 获取日期
     *
     * @return cdate - 日期
     */

    @ExcelResources(title = "日期",order = 1)
    public String getCdate() {
        return cdate.substring(0,10);
    }

    /**
     * 设置日期
     *
     * @param cdate 日期
     */
    public void setCdate(String cdate) {
        //如果全部为数字，是1900-1-1的日期天数差
        if (RegexUtil.isNumber(cdate)){
            Double d = Double.parseDouble(cdate);
            Date date = HSSFDateUtil.getJavaDate(d);
            this.cdate = DateUtil.toDateTimeString(date,"yyyy-MM-dd");
        } else {
            this.cdate = cdate;
        }
    }

    /**
     * 获取办理渠道，微信，门店，营销方案
     *
     * @return handler_channel - 办理渠道，微信，门店，营销方案
     */

    @ExcelResources(title = "办理渠道",order = 2)
    public String getHandlerChannel() {
        return handlerChannel;
    }

    /**
     * 设置办理渠道，微信，门店，营销方案
     *
     * @param handlerChannel 办理渠道，微信，门店，营销方案
     */
    public void setHandlerChannel(String handlerChannel) {
        this.handlerChannel = handlerChannel;
    }

    /**
     * 获取手机号码
     *
     * @return phone - 手机号码
     */
    @ExcelResources(title = "手机号码",order = 3)
    public String getPhone() {
        return phone;
    }

    /**
     * 设置手机号码
     *
     * @param phone 手机号码
     */
    public void setPhone(String phone) {
        this.phone = phone;
    }

    /**
     * 获取副卡号码
     *
     * @return phone_second - 副卡号码
     */
    @ExcelResources(title = "副卡号码",order = 4)
    public String getPhoneSecond() {
        return phoneSecond;
    }

    /**
     * 设置副卡号码
     *
     * @param phoneSecond 副卡号码
     */
    public void setPhoneSecond(String phoneSecond) {
        this.phoneSecond = phoneSecond;
    }

    /**
     * 获取办理业务
     *
     * @return biz_type - 办理业务
     */
    @ExcelResources(title = "办理业务",order = 5)
    public String getBizType() {
        return bizType;
    }

    /**
     * 设置办理业务
     *
     * @param bizType 办理业务
     */
    public void setBizType(String bizType) {
        this.bizType = bizType;
    }

    /**
     * 获取业务明细
     *
     * @return biz_detail - 业务明细
     */
    @ExcelResources(title = "业务明细",order = 6)
    public String getBizDetail() {
        return bizDetail;
    }

    /**
     * 设置业务明细
     *
     * @param bizDetail 业务明细
     */
    public void setBizDetail(String bizDetail) {
        this.bizDetail = bizDetail;
    }

    /**
     * 获取原产品规格
     *
     * @return spec_pri - 原产品规格
     */
    @ExcelResources(title = "原规格产品",order = 7)
    public String getSpecPri() {
        return specPri;
    }

    /**
     * 设置原产品规格
     *
     * @param specPri 原产品规格
     */
    public void setSpecPri(String specPri) {
        this.specPri = specPri;
    }

    /**
     * 获取新产品规格
     *
     * @return spec_cur - 新产品规格
     */
    @ExcelResources(title = "新规格产品",order = 8)
    public String getSpecCur() {
        return specCur;
    }

    /**
     * 设置新产品规格
     *
     * @param specCur 新产品规格
     */
    public void setSpecCur(String specCur) {
        this.specCur = specCur;
    }

    /**
     * 获取金额
     *
     * @return sum_money - 金额
     */

    @ExcelResources(title = "金额",order = 9)
    public BigDecimal getSumMoney() {
        return sumMoney;
    }

    /**
     * 设置金额
     *
     * @param sumMoney 金额
     */
    public void setSumMoney(BigDecimal sumMoney) {
        this.sumMoney = sumMoney;
    }

    /**
     * 重载，poi传入字符串
     * @param sumMoney
     */

    public void setSumMoney(String sumMoney) {
        this.sumMoney = StringUtils.isEmpty(sumMoney)? BigDecimal.valueOf(Long.valueOf(0)): BigDecimal.valueOf(Long.valueOf(sumMoney));
    }

    /**
     * 工号明细
     * @return
     */

    @ExcelResources(title = "工号明细",order = 10)
    public String getHandlerNo() {
        return handlerNo;
    }

    public void setHandlerNo(String handlerNo) {
        this.handlerNo = handlerNo;
    }

    /**
     * 获取门店名称
     *
     * @return organization_name - 门店名称
     */

    @ExcelResources(title = "门店名称",order = 11)

    public String getOrganizationName() {
        return organizationName;
    }

    /**
     * 设置门店名称
     *
     * @param organizationName 门店名称
     */
    public void setOrganizationName(String organizationName) {
        this.organizationName = organizationName;
    }

    /**
     * 获取办理方式
     *
     * @return handle_type - 办理方式
     */
    @ExcelResources(title = "办理方式",order = 12)

    public String getHandleType() {
        return handleType;
    }

    /**
     * 设置办理方式
     *
     * @param handleType 办理方式
     */
    public void setHandleType(String handleType) {
        this.handleType = handleType;
    }

    /**
     * 获取批次号
     *
     * @return batch_no - 批次号
     */

    @ExcelResources(title = "批次号",order = 13)
    public String getBatchNo() {
        return batchNo;
    }
    /**
     * 设置批次号
     *
     * @param batchNo 批次号
     */
    public void setBatchNo(String batchNo) {
        this.batchNo = batchNo;
    }

    /**
     * 包编
     * @return
     */

    @ExcelResources(title = "包编",order = 14)
    public String getPackageNo() {
        return packageNo;
    }

    public void setPackageNo(String packageNo) {
        this.packageNo = packageNo;
    }

    /**
     * 获取月赠送金额
     *
     * @return donate_month - 月赠送金额
     */

    @ExcelResources(title = "月赠送金额",order = 15)
    public BigDecimal getDonateMonth() {
        return donateMonth;
    }

    /**
     * 设置月赠送金额
     *
     * @param donateMonth 月赠送金额
     */
    public void setDonateMonth(BigDecimal donateMonth) {
        this.donateMonth = donateMonth;
    }

    public void setDonateMonth(String donateMonth) {
        this.donateMonth = StringUtils.isEmpty(donateMonth)? BigDecimal.valueOf(Long.valueOf(0)): BigDecimal.valueOf(Long.valueOf(donateMonth));
    }

    /**
     * 获取单元编码
     *
     * @return organization_no - 单元编码
     */

    @ExcelResources(title = "单元编码",order = 16)
    public String getOrganizationNo() {
        return organizationNo;
    }

    /**
     * 设置单元编码
     *
     * @param organizationNo 单元编码
     */
    public void setOrganizationNo(String organizationNo) {
        this.organizationNo = organizationNo;
    }

    /**
     * 获取员工姓名
     *
     * @return employer - 员工姓名
     */
    @ExcelResources(title = "员工姓名",order = 17)
    public String getEmployer() {
        return employer;
    }

    /**
     * 设置员工姓名
     *
     * @param employer 员工姓名
     */
    public void setEmployer(String employer) {
        this.employer = employer;
    }

    /**
     * 获取计件酬金
     *
     * @return reward_piecework - 计件酬金
     */
    @ExcelResources(title = "计件酬金",order = 18)
    public BigDecimal getRewardPiecework() {
        return rewardPiecework;
    }

    /**
     * 设置计件酬金
     *
     * @param rewardPiecework 计件酬金
     */
    public void setRewardPiecework(BigDecimal rewardPiecework) {
        this.rewardPiecework = rewardPiecework;
    }

    public void setRewardPiecework(String rewardPiecework) {
        this.rewardPiecework = StringUtils.isEmpty(rewardPiecework)? BigDecimal.valueOf(Long.valueOf(0)): BigDecimal.valueOf(Long.valueOf(rewardPiecework));
    }


    /**
     * 获取移动积分
     *
     * @return score - 移动积分
     */
    @ExcelResources(title = "移动积分",order = 19)
    public BigDecimal getScore() {
        return score;
    }

    /**
     * 设置移动积分
     *
     * @param score 移动积分
     */
    public void setScore(BigDecimal score) {
        this.score = score;
    }

    public void setScore(String score) {
        this.score = StringUtils.isEmpty(score)? BigDecimal.valueOf(Long.valueOf(0)): BigDecimal.valueOf(Long.valueOf(score));
    }

    /**
     * 手机/套卡/配件差价
     * @return
     */
    @ExcelResources(title = "手机/套卡/配件差价",order = 20)
    public BigDecimal getPartsBalance() {
        return partsBalance;
    }

    public void setPartsBalance(BigDecimal partsBalance) {
        this.partsBalance = partsBalance;
    }
    public void setPartsBalance(String partsBalance) {
        this.partsBalance = StringUtils.isEmpty(partsBalance)? BigDecimal.valueOf(Long.valueOf(0)): BigDecimal.valueOf(Long.valueOf(partsBalance));
    }

    /**
     * 获取提成
     *
     * @return commission - 提成
     */
    @ExcelResources(title = "提成",order = 21)
    public BigDecimal getCommission() {
        return commission;
    }

    /**
     * 设置提成
     *
     * @param commission 提成
     */
    public void setCommission(BigDecimal commission) {
        this.commission = commission;
    }

    public void setCommission(String commission) {
        this.commission = StringUtils.isEmpty(commission)? BigDecimal.valueOf(Long.valueOf(0)): BigDecimal.valueOf(Long.valueOf(commission));
    }
    /**
     * 获取备注
     *
     * @return remark - 备注
     */

    @ExcelResources(title = "备注",order = 22)
    public String getRemark() {
        return remark;
    }

    /**
     * 设置备注
     *
     * @param remark 备注
     */
    public void setRemark(String remark) {
        this.remark = remark;
    }

    /**
     * 审核标致
     * 0：未审核 1；审核失败 2：审核通过
     * @return
     */
    public Integer getVerify() {
        return verify;
    }

    public void setVerify(Integer verify) {
        this.verify = verify;
    }

    /**
     * 获取创建时间
     *
     * @return create_time - 创建时间
     */
    public Date getCreateTime() {
        return createTime;
    }

    /**
     * 设置创建时间
     *
     * @param createTime 创建时间
     */
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    /**
     * 获取修改时间
     *
     * @return update_time - 修改时间
     */
    public Date getUpdateTime() {
        return updateTime;
    }

    /**
     * 设置修改时间
     *
     * @param updateTime 修改时间
     */
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}